package Routes

import (
	"ali-hr/Http/Controller/Department"
	"ali-hr/Services/MiddleWare"
	"github.com/gin-gonic/gin"
)

/**
 * Created by Goland
 * User: wkk alisleepy@hotmail.com
 * Time: 2022/3/27 - 22:59
 * Desc: <部门相关路由>
 */

func InitDepartmentRoutes(r *gin.Engine) {
	// 使用jwt中间件
	departmentGroup := r.Group("/department").Use(MiddleWare.JWTAuth())
	{
		// 列表
		departmentGroup.GET("/list", Department.List)
		// 所有部门，前端组件使用
		departmentGroup.GET("/all", Department.All)
		// 部门详情
		departmentGroup.GET("/info", Department.Info)
		// 添加
		departmentGroup.POST("/create", Department.Create)
		// 更新
		departmentGroup.POST("/update", Department.Update)
		// 删除
		departmentGroup.POST("/delete", Department.Delete)
		// 更新部门状态
		departmentGroup.POST("/change_status", Department.ChangeStatus)
		// 获取部门的子部门，儿子部门
		departmentGroup.GET("/children", Department.Children)
		// 获取部门的所有子部门，包含孙子部门
		departmentGroup.GET("/all_children", Department.AllChildren)
		// 导出excel
		departmentGroup.GET("/export", Department.Export)
		// 组织架构树
		departmentGroup.GET("/tree", Department.Tree)
	}
}
